package com.bii.gelapp;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Display;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;

public class DeleteDialog extends Dialog {
	

	public static Context context;
	String origin;
	String key;
	public static Dialog d;
	Button btYes, btNo;
	
	public DeleteDialog(Context context, String org, String key) {
		super(context);
		this.context = context;
		this.origin = org;
		this.key = key;
		// TODO Auto-generated constructor stub
	}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.deletedialog);
		WindowManager.LayoutParams wmlp = this.getWindow().getAttributes();
		WindowManager wm = (WindowManager) this.context
				.getSystemService(Context.WINDOW_SERVICE);
		Display display = wm.getDefaultDisplay();
		wmlp.gravity = Gravity.CENTER_VERTICAL;
		wmlp.width = display.getWidth();
		
		btYes = (Button)findViewById(R.id.btYes);
		btYes.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if(origin.equals("MarkerDialog")){
					MarkerDialog.deleteFile(key);
				}
				else if(origin.equals("SettingsDialog")){
					SettingsDialog.deleteFile(key);
				}
				dismiss();
				
			}
		});
		btNo = (Button)findViewById(R.id.btNo);
		btNo.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				dismiss();
			}
		});
		
	}
}
